<?php
Class Category extends CActiveRecord{
    public static function model($class= __CLASS__){
        return parent::model($class);
    }
    Public function tableName(){
        return 'category';
    }
    public static function GetParentId($parent_id){
        $category =Category::model()->findByPk($parent_id);
        if($category){
            return $category['category_name'];
        } else {
            return 'root';
        }

    }
    public static function GetMenu($category_id){
        $category =Category::model()->findByPk($category_id);
        if($category){
            return $category['category_name'];
        } else {
            return 'root';
        }
    }
}